home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / gfx / show / gs_src_gs.lha / gs5.03 / slzwx.h < prev    next >
C/C++ Source or Header  |  1995-10-15  |  3KB  |  67 lines

  1. /* Copyright (C) 1993, 1995 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* slzwx.h */
  20. /* LZW filter state definition */
  21. /* Requires strimpl.h */
  22.  
  23. typedef struct lzw_decode_s lzw_decode;
  24. typedef struct lzw_encode_table_s lzw_encode_table;
  25. typedef struct stream_LZW_state_s {
  26.     stream_state_common;
  27.         /* The following are set before initialization. */
  28.     int InitialCodeLength;        /* decoding only */
  29.     bool FirstBitLowOrder;        /* decoding only */
  30.     bool BlockData;            /* decoding only */
  31.     int EarlyChange;        /* decoding only */
  32.         /* The following are updated dynamically. */
  33.     uint bits;            /* buffer for input bits */
  34.     int bits_left;            /* # of valid low bits left */
  35.     int bytes_left;            /* # of bytes left in current block */
  36.                     /* (arbitrary large # if not GIF) */
  37.     union _lzt {
  38.         lzw_decode *decode;
  39.         lzw_encode_table *encode;
  40.     } table;
  41.     uint next_code;            /* next code to be assigned */
  42.     int code_size;            /* current # of bits per code */
  43.     int prev_code;            /* previous code recognized */
  44.                     /* or assigned */
  45.     uint prev_len;            /* length of prev_code */
  46.     int copy_code;            /* code whose string is being */
  47.                     /* copied, -1 if none */
  48.     uint copy_len;            /* length of copy_code */
  49.     int copy_left;            /* amount of string left to copy */
  50.     bool first;            /* true if no output yet */
  51. } stream_LZW_state;
  52. extern_st(st_LZW_state);
  53. #define public_st_LZW_state()    /* in slzwc.c */\
  54.   gs_public_st_ptrs1(st_LZW_state, stream_LZW_state,\
  55.     "LZWDecode state", lzwd_enum_ptrs, lzwd_reloc_ptrs, table.decode)
  56. #define s_LZW_set_defaults_inline(ss)\
  57.   ((ss)->InitialCodeLength = 8,\
  58.    (ss)->FirstBitLowOrder = false,\
  59.    (ss)->BlockData = false,\
  60.    (ss)->EarlyChange = 1)
  61. extern const stream_template s_LZWD_template;
  62. extern const stream_template s_LZWE_template;
  63.  
  64. /* Shared procedures */
  65. void s_LZW_set_defaults(P1(stream_state *));
  66. void s_LZW_release(P1(stream_state *));
  67.